package cn.pengpeng.day05.mywc;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;

public class Bean implements WritableComparable<Bean>{

	private String word;
	private int count;
	
	
	
	public void set(String word, int count) {
		this.word = word;
		this.count = count;
	}
	public String getWord() {
		return word;
	}
	public void setWord(String word) {
		this.word = word;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	@Override
	public void write(DataOutput out) throws IOException {
		out.writeUTF(this.word);
		out.writeInt(this.count);
		
	}
	@Override
	public void readFields(DataInput in) throws IOException {
		this.word = in.readUTF();
		this.count = in.readInt();
		
	}
	@Override
	public int compareTo(Bean o) {
		System.out.println("bean 的compareTo执行了..........................................");
		return this.word.compareTo(o.getWord());
	}
	
	
	
}
